<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px">
        <el-menu class="el-menu-vertical-demo" router>
          <div class="title">豆瓣数据可视化系统</div>
          <el-menu-item index="home">
            <el-icon>
              <House />
            </el-icon>
            <span>首页</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>个人信息</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>书籍统计页</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>种类分析 </span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>书籍信息分析</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>评论分析</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>年份分析</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>书本词云图</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>书本介绍词云图</span>
          </el-menu-item>
          <el-menu-item>
            <el-icon>
              <Document />
            </el-icon>
            <span>图书推荐</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <span class="header-left-content"
            >尊敬的 {{ name }} 欢迎您登录本系统</span
          >
          <div class="header-right-content">
            <el-badge
              :is-dot="hasNoReadMsg"
              class="item"
              @click="openDepartmentMessage"
            >
              <el-icon :size="20" class="message">
                <Message />
              </el-icon>
            </el-badge>
            <el-avatar :size="24" />
          </div>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
  <!-- <departmentMsg ref="department_msg"></departmentMsg> -->
</template>

<script lang="ts" setup>
// import { onUnmounted, ref, computed } from "vue";
// import { Menu as IconMenu } from "@element-plus/icons-vue";
// import departmentMsg from "@/components/department_message.vue";
// // import { getReadListAndStatus } from '@/api/dep_msg.js'
import { useRouter } from "vue-router";
// import { useUserInfo } from "@/store/userinfor.js";
// import { useMsg } from "@/store/message.js";
// const msgStore = useMsg();
// 就是这个信封的作用应该就是也是查看消息的作用好应该我也不确定

// 信封的作用就是有新消息,点击可以查看具体有哪些新消息, 你数据库中新增数据看看
// const timer = setInterval(() => {
//   msgStore.returnReadList(localStorage.getItem("id"));
// }, 10000);

// const hasNoReadMsg = computed(() => msgStore.read_list?.length);

// const userStore = useUserInfo();
const router = useRouter();
// const name = localStorage.getItem("name");

// const goLogin = () => {
//   router.push("/login");
// };
// const department_msg = ref();
// const openDepartmentMessage = () => {
//   department_msg.value.open();
// };

// onUnmounted(() => {
// 	clearInterval(timer)
// })
// console.log('333333333333333333333333333333333',msgStore.read_list.length,import.meta.env.VITE_API_BASEURL );
</script>

<style lang="scss" scoped>
// 侧边栏
.el-aside {
  height: 100vh;
  background: #2b303b;
  width: 210px;
  // 隐藏滚动条
  overflow-x: hidden;

  // 菜单
  .el-menu {
    background: #2b303b;
    width: 210px;
    height: 100vh;
    border-right: 0px;
  }

  // 标题
  .title {
    padding: 20px;
    display: flex;
    justify-content: center;
    color: #fff;
    background: #2b303b;
  }

  .el-menu-item {
    color: #fff;
  }

  // .el-sub-menu__title {
  // 	color: #fff;
  // }
}

.el-header {
  display: flex;
  height: 55px;
  background: #262f3e;
  color: #c1c6c8;
  align-items: center;
  justify-content: space-between;

  // 欢迎语
  .header-left-content {
    font-size: 14px;
  }

  .header-right-content {
    width: 160px;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

// 徽章
.item {
  cursor: pointer;
}

.el-main {
  --el-main-padding: 0;
  background-color: #f3f4fa;
}

// 无子菜单的
.el-menu-item:hover {
  background: #006eff;
}

// 有子菜单的
:deep(.el-sub-menu__title:hover) {
  background: #006eff;
}

:deep(.el-sub-menu__title) {
  color: #fff;
}

:deep(.el-menu--inline) {
  background: #2b303b;
}
</style>
